home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / surf / vaxscr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.4 KB  |  175 lines

  1. #include "vaxconio.h"
  2. #define false 0
  3. #define true (!false)
  4. int vx_top=1,vx_bot=24;
  5. textattr()
  6. {}
  7. kbhit()
  8. {return false;}
  9. delay(int i)
  10. {}
  11.  
  12. window(int left,int top, int right, int bottom)
  13. {
  14.     if (left==1 && top==1 && bottom==25) {
  15.         printf("\x1b[%d;%dr",1,24);
  16.     }
  17.     vx_top = top;
  18.     vx_bot = bottom;
  19. }
  20. scr_dots(int i)
  21. {
  22. }
  23. scr_gets(char *x)
  24. {
  25.     gets(x);
  26. }
  27. clreol()
  28. {
  29.     printf("\x1b[K");
  30. }
  31. clrscr()
  32. {
  33.     printf("\x1b[2J");
  34. }
  35. cputs(char *line)
  36. {
  37.     printf("%s",line);
  38. }
  39. scr_left(int i)
  40. {
  41.     if (i<=0) return;
  42.     printf("\x1b[%dD",i);
  43. }
  44. scr_right(int i)
  45. {
  46.     if (i<=0) return;
  47.     printf("\x1b[%dC",i);
  48. }
  49. int vx_curx,vx_cury;
  50. gotoxy(int x, int y)
  51. {
  52.     y = y + vx_top - 1;
  53.     if (y>vx_bot) y=vx_bot;
  54.     if (y<vx_top) y=vx_top;
  55.     if (y>25) y=24;
  56.     vx_curx = x; vx_cury = y;
  57.     printf("\x1b[%d;%dH",y,x);
  58. }
  59. insline()
  60. {
  61.     scr_savexy();
  62.     printf("\x1b[%d;%dr",vx_cury,vx_bot);
  63.     printf("\x1b[%d;%dH\x1bM",vx_cury,1);
  64.     scr_restorexy();
  65. }
  66. delline()
  67. {
  68.     scr_savexy();
  69.     printf("\x1b[%d;%dr",vx_cury,vx_bot);
  70.     printf("\x1b[%d;%dH\x1b%c",vx_bot,1,'D');
  71.     scr_restorexy();
  72. }
  73. putch(int char_val)
  74. {
  75.     printf("%c",char_val);
  76. }
  77. scr_refresh()
  78. {
  79. }
  80. int scr_getch()
  81. {
  82.     return getch();
  83. }
  84. scr_init()
  85. {
  86.     printf("\x1b=");
  87. }
  88.  
  89. screen_save()
  90. {}
  91. screen_restore()
  92. {
  93.     clrscr();
  94.     gotoxy(1,1);
  95. }
  96. int vx_topsave,vx_botsave;
  97. scr_savexy()
  98. {
  99.     vx_topsave = vx_top;
  100.     vx_botsave = vx_bot;
  101.     printf("\x1b\x37");
  102. }
  103. scr_restorexy()
  104. {
  105.     printf("\x1b\x38");
  106.     vx_top = vx_topsave;
  107.     vx_bot = vx_botsave;
  108. }
  109. scr_end()
  110. {
  111.     printf("\x1b>");
  112. }
  113.  
  114. gettextinfo(struct text_info *r)
  115. {
  116.     r->curx = 1;
  117.     r->cury = 1;
  118.     r->wintop = vx_top;
  119. }
  120.  
  121.  
  122. textbackground(int color_num)
  123. {}
  124. textcolor(int colornum)
  125. {}
  126.  
  127. int vscrcolor = 0;
  128. scr_norm()  /* yellow on blue */
  129. {
  130.     if (vscrcolor==1) return;
  131.     vscrcolor = 1;
  132.     printf("\x1b[0m");
  133. }
  134. scr_inv()   /* black on white */
  135. {
  136.     if (vscrcolor==2) return;
  137.     if (vscrcolor != 1) printf("\x1b[0m");
  138.     vscrcolor = 2;
  139.     printf("\x1b[1m"); /* hiligh */
  140. }
  141. scr_grey()  /* black on grey */
  142. {
  143.     if (vscrcolor==3) return;
  144.     if (vscrcolor != 1) printf("\x1b[0m");
  145.     vscrcolor = 3;
  146.     printf("\x1b[7m"); /* inverse */
  147. }
  148. scr_isblackwhite()
  149. {
  150.     return true;
  151. }
  152. scr_menubg()
  153. {
  154.     scr_norm();
  155. }
  156. scr_menuval()
  157. {
  158.     scr_inv();
  159. }
  160. scr_menuhi()
  161. {
  162.     scr_grey();
  163. }
  164.  
  165. #include <descrip.h>
  166. vax_edt(char *s)     /* call the vax EDT editor */
  167. {
  168.     $DESCRIPTOR(sdesc,"");
  169.     sdesc.dsc$a_pointer = s;
  170.     sdesc.dsc$w_length = strlen(s);
  171.     edt$edit(&sdesc,&sdesc);
  172. }
  173.  
  174.                                                                                                          
  175.